#include "memPage_t.h"

// Initialize static fields
int memPage_t::defaultPageSize = 8;

memPage_t::memPage_t() :
	m_capacity(defaultPageSize) {
	constructPage();
}

memPage_t::memPage_t(int pageSize) :
	m_capacity(pageSize) {
	constructPage();
}

memPage_t::~memPage_t() {
	delete[] m_buf;
}

bool memPage_t::setCurrentPos(int newPos) {
	if (newPos > m_actualSize || newPos < 0) {
		return false;
	}

	m_curPos = newPos;
	return true;
}

/* Private Functions */
void memPage_t::constructPage() {
	m_actualSize=0;
	m_curPos=0;

	m_buf = new byte[m_capacity];
}